<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      <h3>props</h3>
      <!-- 如果想传递一个数字，前面需要加上v-bind -->
      <!-- <child name="pengshao" :age-count="23"></child> -->

      <child :obj="obj"></child>
    </div>

    <script src="../../Vue.js"></script>
    <script>
      const Child = {
        // props: ["name", "ageCount"],
        // props除了用数组接受以外，还可以使用对象的方式进行接收
        props: {
          // name: String,
          // ageCount: Number,
          obj: Object,
        },
        template: `
          <div>
            <div>{{ obj.name }}的年龄是{{ obj.ageCount }}岁</div>
          </div>
        `,
      };

      new Vue({
        el: "#app",
        data: {
          // count: 23,
          obj: {
            name: "pengshao",
            age: 23,
          },
        },
        components: {
          Child,
        },
      });
    </script>
  </body>
</html>
